//
//  EditorInforCollectionViewCell.m
//  XiMaLaYa
//
//  Created by dllo on 15/11/12.
//  Copyright © 2015年 L-G. All rights reserved.
//

#import "EditorInforCollectionViewCell.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>

@implementation EditorInforCollectionViewCell
- (void)dealloc
{
    [_labelTitle release];
    [_labelTrackTitle release];
    [_imagePic release];
    [super dealloc];
}
#pragma mark 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.imagePic = [[UIImageView alloc] init];
        self.imagePic.layer.shadowColor = [UIColor grayColor].CGColor;
        self.imagePic.layer.shadowOffset = CGSizeMake(5, - 5);
        self.imagePic.layer.shadowOpacity = 0.5;
        [self.contentView addSubview:self.imagePic];
        [_imagePic release];

        
        self.labelTitle = [[UILabel alloc] init];
        self.labelTitle.font = [UIFont systemFontOfSize:11];
        self.labelTitle.backgroundColor = [UIColor grayColor];
        self.labelTitle.alpha = 0.7;
        self.labelTitle.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.labelTitle];
        [_labelTitle release];
        
        
        self.labelTrackTitle = [[UILabel alloc] init];
        self.labelTrackTitle.font = [UIFont systemFontOfSize:12];
        self.labelTrackTitle.numberOfLines = 0;
        [self.contentView addSubview:self.labelTrackTitle];
        [_labelTrackTitle release];
        
           }
    return self;
}
#pragma mark 设置frame
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imagePic.frame = CGRectMake(5, 5, self.frame.size.width - 10, self.frame.size.height - 30);
    self.labelTitle.frame = CGRectMake(5, self.frame.size.height - 40, self.frame.size.width - 10, 15);
    self.labelTrackTitle.frame = CGRectMake(5, self.frame.size.height - 25, self.frame.size.width - 10, 30);
}
#pragma mark 给cell赋值
- (void)setEditorAlbums:(EditorAlbums *)editorAlbums
{
    if (_editorAlbums != editorAlbums) {
        [_editorAlbums release];
        _editorAlbums = [editorAlbums retain];
    }
    self.labelTitle.text = editorAlbums.title;
    self.labelTrackTitle.text = editorAlbums.trackTitle;
    NSURL *url = [NSURL URLWithString:editorAlbums.coverLarge];
    [self.imagePic sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
}
@end
